class Semaphor::Reports::TimelineLogins < Semaphor::Reports::Base
  
  self.category = "General"
  self.title = "Daily Unique Visitors"
  self.template = :timeline
  self.cols = [
    ['count', "Visitors"]
  ]
  
  def run
  	query = %{
      SELECT COUNT(DISTINCT user_id) AS count,
         DATE_FORMAT(created_at, "%b %e %Y") AS date,
         DATE_FORMAT(created_at, "%a") AS weekday
      FROM hits
      GROUP BY DATE_FORMAT(created_at, "%Y-%m-%d")
      ORDER BY DATE_FORMAT(created_at, "%Y-%m-%d")
    }

    @data = db.select_all(query)
  end
    
end
